<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>home</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" crossorigin="anonymous"></script>

</head>
<body>
<div class="container">
    <div class="card mt-3">
        <div class="card-header">
            Employee Management System
        </div>
<a href="${pageContext.servletContext.contextPath}/employee?id=new">
    <input type="button" class="btn btn-primary" value="Add Employee">
</a>
<table class="table">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">Name</th>
      <th scope="col">Position</th>
      <th scope="col">Company</th>
       <th scope="col">Department</th>
       <th scope="col">Actions</th>
    </tr>
  </thead>
  <tbody>
   <c:forEach items="${employees}" var="item" varStatus="loop">
    <tr>
      <th scope="row">${loop.count}</th>
      <td>${item.name}</td>
      <td>${item.position}</td>
      <td>${item.company}</td>
      <td>${item.department }</td>
      <td>
          <a href="${pageContext.servletContext.contextPath}/employee?id=${item.id}">
              <input type="button" class="btn btn-primary" value="Edit">
          </a>
          <a href="${pageContext.servletContext.contextPath}/delete?id=${item.id}">
              <input type="button" class="btn btn-warning" value="Delete">
          </a>
    </tr>
    </c:forEach>
      </tbody>
</table>
    </div>
</div>

</body>
</html>
